GET_STATE (FB)¶
FUNCTION_BLOCK GET_STATE EXTENDS CiA405Base
Function block returns the CANopen state of device with NodeID DEVICE
.
The ourput STATE
is defined as follows:
If guarding/heartbeat is not active for the selected
DEVICE
:DEVICE_STATE.NOT_AVAIL is returned if
DEVICE
doesn’t respond in configuration phase.DEVICE_STATE.UNKNOWN is returned in all other cases even if a boot-up message was received.
If guarding/heartbeat is not active but at least one cyclic synchronous TPDO is configured for the selected
DEVICE
:DEVICE_STATE.NOT_AVAIL is returned if
DEVICE
doesn’t respond in configuration phase.DEVICE_STATE.OPERATIONAL is returned if cyclic synchronous TPDOs are received correctly
DEVICE_STATE.UNKNOWN is returned in all other cases.
If guarding/heartbeat is active:
If there is no guarding/heartbeat error (due to timeout) received NMT state is returned.
DEVICE_STATE.NOT_AVAIL is returned if device is not responding or in case of huarding/heartbeat error.
- InOut:
Scope
Name
Type
Initial
Comment
Inherited from
Input
NETWORK
USINT
1
CAN network number the function block should operate on. Note: It is not the same like the network number in CANBus configurator. The CiA405
NETWORK
is calculated by NetID + 1. Example: 1 = CAN0, 2 = CAN1, 3 = CAN2, …CiA405Base
ENABLE
BOOL
FALSE
Enables the function block on rising edge. Aborts operation on falling edge.
CiA405Base
TIMEOUT
UDINT
0
Timeout in ms; 0 means no timeout
CiA405Base
Output
CONFIRM
BOOL
FALSE
TRUE
: function block finished without errorCiA405Base
ERROR
CANOPEN_KERNEL_ERROR.CANOPEN_KERNEL_NO_ERROR
Error code: see CANOPEN_KERNEL_ERROR for further details
CiA405Base
Input
DEVICE
0
NodeID of device; 0 means local device (= CANopenManager)
Output
STATE
0
contains current NMT state